// pages/jilu/jilu.js
const app = getApp()
Page({
  data: {
    maxDate: new Date().setMonth(new Date().getMonth() + 1),
    formatter(day) {
      //执行多次
      // console.log(app.globalData)
      // console.log(userdates)
      // console.log(app.globalData.isFormattering)

      // if (!app.globalData.isFormattering) {
      // console.log(app.globalData)
      if (!app.globalData.isNewUser) {
        let userdates = app.globalData.userdates
        const month = day.date.getMonth() + 1;
        const date = day.date.getDate();

        for (let j = 0, len = userdates.length; j < len; j++) {
          // console.log(userdates[j],typeof userdates[j])
          let user_month = userdates[j].getMonth() + 1
          let user_date = userdates[j].getDate()
          if (month == user_month && date == user_date) {
            // day.bottomInfo = '打卡';
            day.text = "打卡"
            day.type = "selected"
            // console.log("---", day.date)
          }
        }
        // app.globalData.isFormattering = true
        // }
      }
      // console.log(day)
      // console.log(day.date)


      // const mydate = new Date();
      // const mymonth = mydate.getMonth() + 1;
      // const mydate = mydate.getDate();


      // if (date == new Date().getDate() && month == new Date().getMonth() + 1) {
      //   day.bottomInfo = '打卡';
      // }
      // if (month === 6) {
      //   if (date === 1) {
      //     day.topInfo = '1.2.3.4.5.6';
      //   } else if (date === 7) {
      //     day.topInfo = '---';
      //   } else if (date === 14) {
      //     day.text = '今天';
      //   } else if (date) {
      //     // day.bottomInfo = '123456';
      //     day.bottomInfo = '打卡';

      //   }
      // }

      // if (day.type === 'start') {
      //   day.bottomInfo = '入住';
      // } else if (day.type === 'end') {
      //   day.bottomInfo = '离店';
      // }

      return day;
    },
  },
  onLoad() {

  },
  onReady() {
    // console.log("///",this.data)
  }
});